package com.menker.app.rest;

import com.menker.app.Constants.API.PATH;
import com.menker.app.biz.PageListInfo;
import com.menker.app.rest.result.ApiResult;
import com.menker.app.rest.result.AppInfo;
import com.menker.app.rest.result.ChannelInfo;
import com.menker.app.rest.result.LoginResult;
import com.menker.app.rest.result.MsgInfo;
import com.menker.app.rest.result.ShareInfo;
import com.menker.app.rest.result.UploadResult;

import org.json.JSONObject;

import java.util.List;
import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import rx.Observable;


public interface Api {

    @POST(PATH.LOGIN)
    Observable<LoginResult> login(@Header("Ticket") String ticket,
                                  @Query("AppOS") String appOS,
                                  @Query("RegistrationId") String registrationId,
                                  @Query("MobilePhone") String mobilePhone,
                                  @Query("VerifyCode") String verifyCode,
                                  @Query("Extend") String extend
    );

    @POST(PATH.THIRD_LOGIN)
    Observable<LoginResult> thirdLogin(@Header("Ticket") String ticket,
                                @Query("AppOS") String appOS,
                                @Query("RegistrationId") String registrationId,
                                @Query("OpenId") String openId,
                                @Query("PlatFrom") String platFrom,
                                @Query("AccessToken") String accessToken,
                                @Query("NickName") String nickName,
                                @Query("Avatar") String avatar,
                                @Query("Extend") String extend
    );

    @GET(PATH.GET_CHANNEL_ALL)
    Observable<ChannelInfo> getAllChannel(@Header("Ticket") String ticket
    );

    @POST(PATH.CREATE_ORDER)
    Observable<ApiResult> createOrder(@Header("Ticket") String ticket,
                                      @Query("OrderId") String orderId
    );

    @GET(PATH.GET_SHARE_INFO)
    Observable<ShareInfo> getShareInfo(@Header("Ticket") String ticket,
                                    @Query("numid") String itemId
    );

    @GET(PATH.GET_APP_INFO)
    Observable<AppInfo> getAppInfo(@Header("Ticket") String ticket,
                                   @Query("AppOS") String appOS,
                                   @Query("RegistrationId") String registrationId,
                                   @Query("Version") int version
    );

    @Multipart
    @POST(PATH.UPLOAD_IMAGE)
    Observable<UploadResult> uploadImg(@Header("Ticket") String ticket,
                                       @Part("fileName") String description,
                                       @PartMap() Map<String, RequestBody> maps
    );

    @GET(PATH.GET_MSG)
    Observable<MsgInfo> getMsgInfo(@Header("Ticket") String ticket
                                   );

    @POST(PATH.GET_SHARE)
    Observable<ShareInfo> getShare(@Header("Ticket") String ticket,
                                   @Body PageListInfo pageList
                                   );

}
